FROM golang:1.22.1-alpine3.19 as builder
LABEL authors="M. Babenko <maks@babenoff.ru>"

WORKDIR /usr/local/src

RUN apk --no-cache add git gcc musl-dev make gettext

COPY ["go.mod", "go.sum", "./"]

RUN go mod download

COPY ./ .

RUN make test
RUN make build

FROM alpine:3.19 as runer

COPY --from=builder /usr/local/src/bin/fapi /

EXPOSE 8000

ENTRYPOINT ["/fapi"]

